package com.pro.common.log.warn.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pro.baoyi.api.logWarn.model.db.LogFileSizeRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LogFileSizeRecordDao extends BaseMapper<LogFileSizeRecord> {
    @Select("""
                <script>
                    SELECT id,module,file_size
                    FROM log_file_size_record
                    WHERE (module, create_time) IN (
                        SELECT module, MAX(create_time) 
                        FROM log_file_size_record
                        GROUP BY module
                    )
                    ORDER BY create_time DESC
                </script>
            """)
    List<LogFileSizeRecord> getLatestRecordsByModule();
}
